<template>
  <header>
    <div class="content-wrapper">
      <div class="avatar"><img width="64" height="64" :src="seller.avatar" alt=""></div>
      <div class="content">
        <div class="title">
          <span class="brand"></span>
          <span class="name">{{ seller.name }}</span>
        </div>
        <div class="description">
          {{ seller.description }}
        </div>
        <div v-if="seller.supports" class="support">
          <span class="icon" :class="classMap[seller.supports[0].type]"></span>
          <div class="text">{{ seller.supports[0].description }}</div>
        </div>
      </div>
      <div v-if="seller.supports" class="support-count" @click="showDetail">
        <span class="count">{{ seller.supports.length }}个</span>
        <i class="icon-keyboard_arrow_right"></i>
      </div>
    </div>
    <div class="bulletin-wrapper">
      <span class="bulletin-title"></span>
      <span class="bulletin-text">{{ seller.bulletin }}</span>
      <i class="icon-keyboard_arrow_right"></i>
    </div>
    <div class="background">
      <img :src="seller.avatar" />
    </div>
    <div class="detail" v-show="detailShow" transition="fade">
      <div class="detail-wrapper clearfix">
        <div class="detail-main">
          <h1 class="name">{{ seller.name }}</h1>
          <div class="star-wrapper">
            <star :size="48" :score="seller.score"></star>
          </div>
          <div class="title">
            <div class="line"></div>
            <div class="text">优惠信息</div>
            <div class="line"></div>
          </div>
          <ul class="supports">
            <li class="support-item" v-for="(item,index) in seller.supports" :key="index">
              <span class="icon" :class="classMap[seller.supports[index].type]"></span>
              <span class="text">{{ seller.supports[index].description }}</span>
            </li>
          </ul>
          <div class="title">
            <div class="line"></div>
            <div class="text">商家公告</div>
            <div class="line"></div>
          </div>
          <div class="bulletin">
            <p class="content">{{ seller.bulletin }}</p>
          </div>
        </div>
      </div>
      <div class="detail-close icon-close" @click="closeDetail"></div>
    </div>
  </header>
</template>
<script type="text/ecmascript-6">
import star from '../star/star'
export default {
  props: {
    seller: {
      type: Object
    }
  },
  data () {
    return {
      detailShow: false
    }
  },
  created () {
    this.classMap = ['decrease', 'discount', 'special', 'invoice', 'guarantee']
  },
  methods: {
    showDetail () {
      this.detailShow = true
    },
    closeDetail () {
      this.detailShow = false
    }
  },
  components: {
    star
  }
}
</script>
<style lang="stylus" rel="stylesheet/stylus" scoped>
  @import "../../common/stylus/mixin.styl"
  header
    color: #ffffff
    background: rgba(7,17,27,.5)
    position: relative
    overflow: hidden
    .content-wrapper
      padding: .48rem .24rem .36rem .48rem
      font-size: 0
      position: relative
      overflow: hidden
      .avatar
        display: inline-block
      .content
        display: inline-block
        font-size: .28rem
        margin-left:.32rem
        .title
          margin:.04rem 0 .16rem 0
          .brand
            display: inline-block
            vertical-align: top
            width: .6rem
            height: .36rem
            bg-image('brand')
            background-size: .6rem .36rem
            background-repeat: no-repeat;
          .name
            margin-left: .12rem
            font-size: .32rem
            line-height: .36rem
            font-weight: bold
        .description
          margin-bottom: .2rem
          line-height: .24rem
          font-size: .24rem
        .support
          font-size: 0;
          .icon
            display: inline-block
            vertical-align: bottom
            width: .2rem
            height: .24rem
            margin-right: .08rem
            background-size: .24rem
            background-repeat: no-repeat
            &.decrease
              bg-image('decrease_1')
            &.discount
              bg-image('discount_1')
            &.special
              bg-image('special_1')
            &.invoice
              bg-image('invoice_1')
            &.guarantee
              bg-image('guarantee_1')
          .text
            font-size: .2rem
            line-height: .24rem
            display: inline-block
      .support-count
        position: absolute
        right: .24rem
        bottom: .28rem
        padding: 0 8px
        height: .48rem
        line-height: .48rem
        border-radius: .28rem
        background-color: rgba(0,0,0,.2)
        text-align: center
        .count
          font-size: .2rem
        .icon-keyboard_arrow_right
          font-size: .2rem
    .bulletin-wrapper
      position: relative
      line-height: .56rem
      padding: 0 .44rem 0 .24rem
      white-space: nowrap
      overflow: hidden
      text-overflow: ellipsis
      font-size: 0
      background: rgba(7,17,27,.2)
      .bulletin-title
        display: inline-block
        width: .44rem
        height: .24rem
        bg-image('bulletin')
        background-size: .44rem .24rem
        vertical-align: top
        margin-top: .14rem
      .bulletin-text
        margin: 0 .08rem
        vertical-align: top
        font-size: .2rem
      .icon-keyboard_arrow_right
        font-size: .2rem
        position: absolute
        right: .24rem
        top: .16rem
    .background
      position: absolute
      top: 0
      left: 0
      width: 100%
      height: 100%
      z-index: -1
      filter:blur(.2rem)
      img
        width: 100%
        height:100%
    .detail
      position: fixed
      top: 0
      left: 0
      z-index: 100
      width: 100%
      height: 100%
      overflow: auto;
      background:rgba(7,17,27,.8)
      transition: all 1s
      backdrop-filter: blur(.2rem)//背景模糊 ios上才能实现
      &.fade-transition
        opacity: 1
        background: rgba(7,17,27,.8)
      &.fade-enter,&.fade-leave
        opacity: 0
        background: rgba(7,17,27,0)
      .detail-wrapper
        width: 100%
        min-height: 100%
        .detail-main
          margin-top: 1.28rem
          padding-bottom: 1.28rem
          .name
            line-height: .32rem
            text-align: center
            font-size: .32rem
            font-weight: 700
          .star-wrapper
            margin-top: .36rem
            padding: .04rem 0
            text-align: center
          .title
            display: flex
            width: 80%
            margin: .36rem auto .48rem auto
            .line
              flex: 1
              position: relative
              top: -.12rem
              border-bottom: 1px solid rgba(255,255,255,.2)
            .text
              padding: 0 .24rem
              font-size: .28rem
              font-weight: 700
          .supports
            padding-left: .7rem;
            .support-item
              padding: 0 .24rem
              margin-bottom:.24rem
              font-size: 0
              &:last-child
                margin-bottom: 0
              .icon
                display: inline-block
                width: .32rem
                height: .32rem
                vertical-align: top
                margin-right: .12rem
                background-size: .32rem .32rem
                background-repeat: no-repeat
                &.decrease
                  bg-image('decrease_2')
                &.discount
                  bg-image('discount_2')
                &.special
                  bg-image('special_2')
                &.invoice
                  bg-image('invoice_2')
                &.guarantee
                  bg-image('guarantee_2')
              .text
                line-height: .24rem
                font-size: .32rem
          .bulletin
            width: 80%
            margin: 0 auto
            .content
              padding: 0 .24rem
              line-height: .48rem
              font-size: .24rem
      .detail-close
        position: relative
        width: .64rem
        height: .64rem
        margin: -1.28rem auto 0 auto
        clear:both
        font-size: .64rem
        cursor: pointer
</style>
